import React, { useState, useEffect } from 'react';
import { Form } from 'antd';
import { useHistory } from 'react-router-dom';
import qs from 'qs';
import { If } from 'babel-plugin-jsx-control-statements';
import RequestApi from '@/utils/request';
import css from '../index.scss';

/**
 * @description 管理员待办中心中停车场设施-附属设施检查
 * -
 */
export default () => {
	const [data, setData] = useState();
	const history = useHistory();
	const search = qs.parse(history.location.search, { ignoreQueryPrefix: true });
	const { id } = search;
	useEffect(() => {
		RequestApi.connection('get', `parkLotRecordTaskLastChange/getLastChange/${id}`).then((response) => {
			setData(response.data.new.parkLotSettingInfoDTO);
		});
		// eslint-disable-next-line react-hooks/exhaustive-deps
	}, []);
	return (
		<If condition={data !== undefined}>
			<div>
				<Form.Item label="停车诱导系统:" className={css.item}>
					<span>{data.guideSystemType}</span>
				</Form.Item>
				<Form.Item label="洗车场:" className={css.item}>
					<If condition={data.haveCarWash === 0}>
						<span>无</span>
					</If>
					<If condition={data.haveCarWash === 1}>
						<span>有</span>
					</If>
				</Form.Item>
				<Form.Item label="通讯信号覆盖率:" className={css.item}>
					<span>
						{data.netAndSignalPercent}
						<span>%</span>
					</span>
				</Form.Item>
				<Form.Item label="立体停车类型:" className={css.item}>
					<span>{data.solidParkType}</span>
				</Form.Item>
				<Form.Item label="消防:" className={css.item}>
					<span>{data.fireFighting}</span>
				</Form.Item>
				<Form.Item label="公共卫生间:" className={css.item}>
					<span>{data.publicToiletCount}</span>
				</Form.Item>
				<Form.Item label="停车管理系统:" className={css.item}>
					<If condition={data.haveParkSystem === 0}>
						<span>无</span>
					</If>
					<If condition={data.haveParkSystem === 1}>
						<span>有</span>
					</If>
				</Form.Item>
				<Form.Item className={css.item}>
					<></>
				</Form.Item>
				<Form.Item className={css.item}>
					<></>
				</Form.Item>
				<Form.Item label="智能化电子收费系统:" className={css.item}>
					<span>{data.intelligentElectricChargeSystem}</span>
				</Form.Item>
				<Form.Item label="监控系统覆盖率:" className={css.item}>
					<span>
						{data.monitorSystemPercent}
						<span>%</span>
					</span>
				</Form.Item>
				<Form.Item label="照明设施:" className={css.item}>
					<If condition={data.haveLightingFacility === 0}>
						<span>无</span>
					</If>
					<If condition={data.haveLightingFacility === 1}>
						<span>有</span>
					</If>
				</Form.Item>
				<Form.Item label="应急照明系统:" className={css.item}>
					<If condition={data.haveUrgeLightingSystem === 0}>
						<span>无</span>
					</If>
					<If condition={data.haveUrgeLightingSystem === 1}>
						<span>有</span>
					</If>
				</Form.Item>
				<Form.Item label="通风系统:" className={css.item}>
					<If condition={data.haveVentilationSystem === 0}>
						<span>无</span>
					</If>
					<If condition={data.haveVentilationSystem === 1}>
						<span>有</span>
					</If>
				</Form.Item>
				<Form.Item label="停车定位器:" className={css.item}>
					<If condition={data.haveParkPosition === 0}>
						<span>无</span>
					</If>
					<If condition={data.haveParkPosition === 1}>
						<span>有</span>
					</If>
				</Form.Item>
				<Form.Item label="停车道路硬化:" className={css.item}>
					<If condition={data.haveRoadHarden === 0}>
						<span>无</span>
					</If>
					<If condition={data.haveRoadHarden === 1}>
						<span>有</span>
					</If>
				</Form.Item>
				<Form.Item label="道闸:" className={css.item}>
					<If condition={data.haveBarrier === 0}>
						<span>无</span>
					</If>
					<If condition={data.haveBarrier === 1}>
						<span>有</span>
					</If>
				</Form.Item>
				<Form.Item label="内墙及顶面是否经过饰面处理:" className={css.item}>
					<If condition={data.wallAndCeillingIsDecoration === 0}>
						<span>无</span>
					</If>
					<If condition={data.wallAndCeillingIsDecoration === 1}>
						<span>有</span>
					</If>
				</Form.Item>
				<Form.Item label="标志标牌:" className={css.item}>
					<span>{data.signage}</span>
				</Form.Item>
				<Form.Item label="现场收费公示牌(个):" className={css.item}>
					<span>{data.spotFeePublicBrand}</span>
				</Form.Item>
				<Form.Item label="充电桩数量(个)" className={css.item}>
					<span>{data.chargePileCount}</span>
				</Form.Item>
			</div>
		</If>
	);
};
